var dht = document.querySelector(".dht");
var dhtt = document.querySelector(".dhtt");
var zhangh = document.querySelector("#zhangh");
var saoma = document.querySelector("#saoma");
var qqtx = document.querySelector("#qqtx");
// dht.forEach(function (v, i) {
//   v.onclick = function () {
//     this.style.display = "none";
//     this.siblings().style.display = "block";
//     console.log(1);
//   };
// });
dht.onclick = function () {
  dht.style.display = "none";
  dhtt.style.display = "block";
  zhangh.style.display = "none";
  saoma.style.display = "block";
};
dhtt.onclick = function () {
  dhtt.style.display = "none";
  dht.style.display = "block";
  saoma.style.display = "none";
  zhangh.style.display = "block";
};
qqtx.onmouseover = function () {
  qqtx.style.backgroundPosition = "-39px 0";
};
qqtx.onmouseout = function () {
  qqtx.style.backgroundPosition = "0 0";
};

// utdl.onclick = function () {
//   if (tel.value == "admin" && password.value == 123456 && yzm.value == 2552) {
//     window.location = "../home-page.html";
//   } else {
//     alert("用户名或密码或验证码输入错误，请重新输入");
//   }
// };
//
//
//

window.onload = function () {
  var tel = document.querySelector("#tel");
  var yzm = document.querySelector("#yzm");
  var passwor = document.querySelector("#passwor");
  var utdl = document.querySelector(".utdl");
  utdl.onclick = function () {
    var login = { username: tel.value, password: passwor.value };
    var dataJson = window.localStorage.getItem("list");
    var success = null;
    dataJson = eval("(" + dataJson + ")");
    for (var i = 0; i < dataJson.length; i++) {
      if (
        (dataJson[i].username == login.username &&
          dataJson[i].password == login.password &&
          yzm.value == 2552) ||
        yzm.value == 4535 ||
        yzm.value == 0894 ||
        yzm.value == 4667
      ) {
        // alert("登陆成功");
        success = 1;
        window.location = "home-page.html";
      }
    }
    if (success == null) {
      alert("用户名或密码或验证码输入错误");
    }
  };
};

// var yzmd = document.querySelectorAll(".yzmd");
// yzmd.forEach(function (v, i) {
//   yzmd[i].onclick = function () {
//     da();
//     yzmd[i].className = "yzmd ";
//   };
// });
// function da() {
//   for (let i = 0; i < yzmd.length; i++) {
//     yzmd[i].className = "yzmd ycnd";
//   }
// }
var yzmd = document.querySelectorAll(".yzmd");
yzmd.forEach(function (v, i) {
  yzmd[i].onclick = function () {
    da();
    // console.log(i);
    if (i + 1 > yzmd.length - 1) {
      i = 0;
      yzmd[i].className = "yzmd ycnd";
    }
    yzmd[i + 1].className = "yzmd ycnd";
  };
});
function da() {
  for (let i = 0; i < yzmd.length; i++) {
    yzmd[i].className = "yzmd";
  }
}
